package com.zhangxx.common.response.resultCode;

/**
 * @ClassName CommonCode
 * @Description  通用返回值
 * @Author leizhang
 * Date 2020/9/19 10:37 上午
 * @Version 1.0
 **/
public enum CommonCode implements ResultCode {
    INVALIDPARAM(false, 10003, "参数不合法"),
    SUCCESS(true, 10000, "操作成功！"),
    FAIL(false, 11111, "操作失败！"),
    UNAUTHENTICATED(false, 10001, "此操作需要登陆系统！"),
    UNAUTHORISE(false, 10002, "权限不足，无权操作！"),
    SERVER_ERROR(false, 99999, "抱歉，系统繁忙，请稍后重试！"), INVENTORY_COUNT_LOW(false,100212 ,"库粗数量不足！！" );
    //    private static ImmutableMap<Integer, CommonCode> codes ;
    /**
     操作是否成功
     **/
    boolean success;
    /**
     操作代码
     **/
    int code;
    /**
     提示信息
     **/
    String message;

    private CommonCode(boolean success, int code, String message) {
        this.success = success;
        this.code = code;
        this.message = message;
    }

    @Override
    public boolean success() {
        return success;
    }

    @Override
    public int code() {
        return code;
    }

    @Override
    public String message() {
        return message;
    }

}
